"UIPATH"="Appearance\Files&Folders\Files Open Warning"
"NAME"="Edit File Open Warnings"
"VERSION"="1.53"
"LANGUAGE"="VBScript"
"TEXT 1"="Change"
"TEXT 2"="Delete"
"OSVERSION"="0001011"
"DESCRIPTION 1"="Every non-associated file type in Windows can be assigned a so called "Open Warning". If a "Open Warning" is set for a file and a user tries to open that file, it will receive a warning that this file should not be open. The warning message can either be the Windows default warning (This file is used by the operating system blah blah blah) or you can choose your own warning."
"DESCRIPTION 2"="Just select the file in question and select "Change" to change the warning that should appear, or "Delete" to remove the warning. If you do not provide any text for the Open Warning, Windows will display a default warning."
"DESCRIPTION 3"="Hint: If the file you want to change does not appear in this list, use the "Add File Open Warning" plug-in."
"AUTHOR"="Xteq Systems"
"CONTACTURL"="http://www.xteq.com"
"COPYRIGHT"="Copyright ⌐ Xteq Systems - All Rights Reserved"
sText_UnknownFile="You have set a command for unknown files. This means, there is a command in your registry that allows you to open any file even if the file type is unknown. Having this function activated, prevents the file warnings from appearing. Please deactivate the Unknown File command using the plugin and return to this plugin."
sP="HKLM\Software\Classes\"
dim iItems 'contains the total amount of the registry keys
Dim aryItems() 'contains the name of the Registry paths (direct files starting with ".")
Dim aryItemsLoc() 'contains the registry location (\ShellNew or \ShellNew-)
Dim aryDesc() 'contains the description of the items
Sub Plugin_Initialize
'check for unknown command!
sUNK_Check=RegReadValue(sP_UnknownFile)
if len(sUNK_Check)>0 then
Call MsgWarning(sText_UnknownFile)
Call Disable
else
if RegPathExists(sP) then
Call ReadRegistry
else
Call Disable
end if
end if
End Sub
Sub ReadRegistry
iItems=RegEnumPaths(sP)
dim aryTemp
ReDim aryTemp(iItems)
dim aryTemp2
ReDim aryTemp2(iItems)
l=1
e=1
sDebug=""
'read all data from the path
For l=1 to iItems
sItem=RegEnumElement(l)
if left(sItem,1)="." then
s=HasOpenWarning(sP, sP & sItem)
''if sItem=".vbs" then DebugMsg("Foundit! at " & l & " s=" & s & " sP=" & sP)
If len(s)>0 then
sDebug=sDebug & sItem
aryTemp(e)=sItem
aryTemp2(e)=s
e=e+1
end if
end if
next
'Call DebugMsg(sDebug)
'okay, now count how many items we have left (that are not empty)...
iItems=0
for l=1 to e-1
If Len(aryTemp(l))>0 then
iItems=iItems+1
end if
next
'redim final arrays with this value
ReDim aryItems(iItems)
ReDim aryItemsLoc(iItems)
ReDim aryDesc(iItems)
'copy from temp array to the final ones
i=1
for l=1 to e-1
If Len(aryTemp(l))>0 then
aryItems(i)=aryTemp(l)
''if aryItems(i)=".vbs" then DebugMsg("Foundit! at " & i)
aryItemsLoc(i)=aryTemp2(l)
i=i+1
end if
next
'fill third array with the file description
for l=1 to iItems
aryDesc(l)=GetFileDescription(aryItems(l))
next
'AND NOW update the UI
for l=1 to iItems
Call SetUIElement(l,aryDesc(l) & " (" & aryItems(l) & ")") 'set data in X-Setup
if Right(aryItemsLoc(l),1)<>"-" then 'not disabled
Call SetUIElementEx(l,true) 'set activated
else
Call SetUIElementEx(l,false) 'set not active
end if
Next
End Sub
'VERSION 1.1
'returns the readable description for a file TYPE. Input is the
'raw file type (e.g. ".TXT").
Function GetFileDescription(DotType)
sxd_BasePath="HKLM\Software\Classes\"
sxd_Path=sxd_BasePath & DotType & "\@"
sxd_Val=RegReadValue(sxd_Path)
if IsEmpty(sxd_Val)=true then
'extended description not found! return default
GetFileDescription="<UNKNOWN>"
else
'found, now get the "real" description
sxd_Path=sxd_BasePath & sxd_Val & "\@"
sxd_Name=RegReadValue(sxd_Path)
if IsEmpty(sxd_Name)=true then
'argh!
GetFileDescription="<UNKNOWN>"
else
GetFileDescription=sxd_Name
end if
end if
End Function
'VERSION 1.0
'returns the reg path to the InfoTip value path or "" if nothing was found. Input is the
'path to the data type (e.g. "HKCR\.TXT").
Function HasOpenWarning(StartPath,Path)
Dim sCheck,sReturn
xd_sV_NoOpen="\NoOpen"
sReturn=""
'first check if this file has a name. If so
'read the data from that name
s=RegReadValue(Path & "\@")
if IsEmpty(s)=false then
'<default path>\.XXX File\NoOpen
sCheck=StartPath & s & xd_sV_NoOpen
if RegValueExists(sCheck) then
sReturn=sCheck
end if
else
'okay, seems this file has no name
sCheck=Path & xd_sV_NoOpen
if RegValueExists(sCheck) then
sReturn=sCheck
end if
end if
HasOpenWarning=sReturn
End Function
Sub Plugin_Apply(ElementIndex,ElementSubIndex)
if ElementSubIndex>0 then
if ElementIndex=1 then 'change
sCurPath=aryItemsLoc(ElementSubIndex)
s=RegReadValue(sCurPath)
s=InputWindow("Please enter the warning that should appear e.g. <Ask the sysop!> or leave empty to display the Windows default warning",s,1)
if IsEmpty(s)=false then
Call RegWriteValue(sCurPath,s,1)
end if
end if
if ElementIndex=2 then 'delete
sCurPath=aryItemsLoc(ElementSubIndex)
Call RegDeleteValue(sCurPath)
end if
'call the holy Windows API
Call IndicateSettingChange()
're-read UI
Call ReadRegistry
else
Call MsgWarning("Please select an item in the list.")